package com.tc.dispatch.csservice.test;

import com.tc.dispatch.csservice.ejb.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import com.tc.dispatch.csservice.model.MaoPiDanJia;
import java.util.List;
import com.tc.dispatch.csservice.model.Product;
import com.tc.dispatch.csservice.model.ManuCost;
import com.tc.dispatch.csservice.model.ProcsDetail;
import com.tc.dispatch.csservice.algorithm.CostAlgorithm;
import com.tc.dispatch.csservice.model.CostEstimateDetail;
import com.tc.dispatch.gsservice.model.OrderSumMain;
import com.tc.dispatch.csservice.filter.ComponentFilter;
import com.tc.dispatch.csservice.algorithm.adjust.Adjust;
import java.util.*;
import com.tc.dispatch.csservice.algorithm.bp.BPInterface;

public class CSTestBpPredicate extends Object {
  private static final String ERROR_NULL_REMOTE = "Remote interface reference is null.  It must be created by calling one of the Home interface methods first.";
  private static final int MAX_OUTPUT_LINE_LENGTH = 100;
  private boolean logging = true;
  private CSServiceHome cSServiceHome = null;
  private CSService cSService = null;

  //Construct the EJB test client
  public CSTestBpPredicate() {
    initialize();
    create();
    int[] fk=this.predicatorNum("$10.5*2.5",BPInterface.YZ_TYPE);
    for(int i=0;i<fk.length;i++)
      log(fk[i]+"");
  }

  public void initialize() {
    long startTime = 0;
    if (logging) {
      log("Initializing bean access.");
      startTime = System.currentTimeMillis();
    }

    try {
      //get naming context
      Context context = new InitialContext();

      //look up jndi name
      Object ref = context.lookup("CSService");
      //look up jndi name and cast to Home interface
      cSServiceHome = (CSServiceHome) PortableRemoteObject.narrow(ref, CSServiceHome.class);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded initializing bean access through Home interface.");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed initializing bean access.");
      }
      e.printStackTrace();
    }
  }

  //----------------------------------------------------------------------------
  // Methods that use Home interface methods to generate a Remote interface reference
  //----------------------------------------------------------------------------

  public CSService create() {
    long startTime = 0;
    if (logging) {
      log("Calling create()");
      startTime = System.currentTimeMillis();
    }
    try {
      cSService = cSServiceHome.create();
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: create()");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: create()");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from create(): " + cSService + ".");
    }
    return cSService;
  }

  //----------------------------------------------------------------------------
  // Methods that use Remote interface methods to access data through the bean
  //----------------------------------------------------------------------------

  public void createMaoPi(MaoPiDanJia maopi) {
    if (cSService == null) {
      System.out.println("Error in createMaoPi(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling createMaoPi(" + maopi + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.createMaoPi(maopi);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: createMaoPi(" + maopi + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: createMaoPi(" + maopi + ")");
      }
      e.printStackTrace();
    }
  }

  public void updateMaoPi(MaoPiDanJia maopi) {
    if (cSService == null) {
      System.out.println("Error in updateMaoPi(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling updateMaoPi(" + maopi + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.updateMaoPi(maopi);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: updateMaoPi(" + maopi + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: updateMaoPi(" + maopi + ")");
      }
      e.printStackTrace();
    }
  }

  public void deleteMaoPi(String ssign) {
    if (cSService == null) {
      System.out.println("Error in deleteMaoPi(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling deleteMaoPi(" + ssign + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.deleteMaoPi(ssign);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: deleteMaoPi(" + ssign + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: deleteMaoPi(" + ssign + ")");
      }
      e.printStackTrace();
    }
  }

  public MaoPiDanJia getMaoPi(String ssign) {
    MaoPiDanJia returnValue = null;

    if (cSService == null) {
      System.out.println("Error in getMaoPi(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling getMaoPi(" + ssign + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.getMaoPi(ssign);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: getMaoPi(" + ssign + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: getMaoPi(" + ssign + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from getMaoPi(" + ssign + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public MaoPiDanJia findMaoPi(String wherestring) {
    MaoPiDanJia returnValue = null;

    if (cSService == null) {
      System.out.println("Error in findMaoPi(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling findMaoPi(" + wherestring + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.findMaoPi(wherestring);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: findMaoPi(" + wherestring + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: findMaoPi(" + wherestring + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from findMaoPi(" + wherestring + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public List findAllMaoPis() {
    List returnValue = null;

    if (cSService == null) {
      System.out.println("Error in findAllMaoPis(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling findAllMaoPis()");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.findAllMaoPis();
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: findAllMaoPis()");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: findAllMaoPis()");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from findAllMaoPis(): " + returnValue + ".");
    }
    return returnValue;
  }

  public List findUndoBaoJia() {
    List returnValue = null;

    if (cSService == null) {
      System.out.println("Error in findUndoBaoJia(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling findUndoBaoJia()");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.findUndoBaoJia();
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: findUndoBaoJia()");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: findUndoBaoJia()");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from findUndoBaoJia(): " + returnValue + ".");
    }
    return returnValue;
  }

  public double getSimilarCost(String ssign, String spec, int fac) {
    double returnValue = 0f;

    if (cSService == null) {
      System.out.println("Error in getSimilarCost(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling getSimilarCost(" + ssign + ", " + spec + ", " + fac + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.getSimilarCost(ssign, spec, fac);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: getSimilarCost(" + ssign + ", " + spec + ", " + fac + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: getSimilarCost(" + ssign + ", " + spec + ", " + fac + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from getSimilarCost(" + ssign + ", " + spec + ", " + fac + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public double generateEstimateCost(Product p) {
    double returnValue = 0f;

    if (cSService == null) {
      System.out.println("Error in generateEstimateCost(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling generateEstimateCost(" + p + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.generateEstimateCost(p);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: generateEstimateCost(" + p + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: generateEstimateCost(" + p + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from generateEstimateCost(" + p + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public int getMPTotalNums(String whereStr) {
    int returnValue = 0;

    if (cSService == null) {
      System.out.println("Error in getMPTotalNums(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling getMPTotalNums(" + whereStr + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.getMPTotalNums(whereStr);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: getMPTotalNums(" + whereStr + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: getMPTotalNums(" + whereStr + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from getMPTotalNums(" + whereStr + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public List findMaoPiByPagesWhereStr(int start, int limit, String whereStr) {
    List returnValue = null;

    if (cSService == null) {
      System.out.println("Error in findMaoPiByPagesWhereStr(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling findMaoPiByPagesWhereStr(" + start + ", " + limit + ", " + whereStr + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.findMaoPiByPagesWhereStr(start, limit, whereStr);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: findMaoPiByPagesWhereStr(" + start + ", " + limit + ", " + whereStr + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: findMaoPiByPagesWhereStr(" + start + ", " + limit + ", " + whereStr + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from findMaoPiByPagesWhereStr(" + start + ", " + limit + ", " + whereStr + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public void removeMaoPi(int id) {
    if (cSService == null) {
      System.out.println("Error in removeMaoPi(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling removeMaoPi(" + id + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.removeMaoPi(id);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: removeMaoPi(" + id + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: removeMaoPi(" + id + ")");
      }
      e.printStackTrace();
    }
  }

  public void updateManuCost(ManuCost mc) {
    if (cSService == null) {
      System.out.println("Error in updateManuCost(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling updateManuCost(" + mc + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.updateManuCost(mc);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: updateManuCost(" + mc + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: updateManuCost(" + mc + ")");
      }
      e.printStackTrace();
    }
  }

  public List findManuCost(String whereStr) {
    List returnValue = null;

    if (cSService == null) {
      System.out.println("Error in findManuCost(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling findManuCost(" + whereStr + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.findManuCost(whereStr);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: findManuCost(" + whereStr + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: findManuCost(" + whereStr + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from findManuCost(" + whereStr + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public List findMinManuCostByPage(int start, int limit, String whereStr) {
    List returnValue = null;

    if (cSService == null) {
      System.out.println("Error in findMinManuCostByPage(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling findMinManuCostByPage(" + start + ", " + limit + ", " + whereStr + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.findMinManuCostByPage(start, limit, whereStr);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: findMinManuCostByPage(" + start + ", " + limit + ", " + whereStr + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: findMinManuCostByPage(" + start + ", " + limit + ", " + whereStr + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from findMinManuCostByPage(" + start + ", " + limit + ", " + whereStr + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public int getMinManuCostTotalNums(String whereStr) {
    int returnValue = 0;

    if (cSService == null) {
      System.out.println("Error in getMinManuCostTotalNums(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling getMinManuCostTotalNums(" + whereStr + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.getMinManuCostTotalNums(whereStr);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: getMinManuCostTotalNums(" + whereStr + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: getMinManuCostTotalNums(" + whereStr + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from getMinManuCostTotalNums(" + whereStr + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public void createProcsDetail(ProcsDetail pd) {
    if (cSService == null) {
      System.out.println("Error in createProcsDetail(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling createProcsDetail(" + pd + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.createProcsDetail(pd);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: createProcsDetail(" + pd + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: createProcsDetail(" + pd + ")");
      }
      e.printStackTrace();
    }
  }

  public void updateProcsDetail(ProcsDetail pd) {
    if (cSService == null) {
      System.out.println("Error in updateProcsDetail(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling updateProcsDetail(" + pd + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.updateProcsDetail(pd);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: updateProcsDetail(" + pd + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: updateProcsDetail(" + pd + ")");
      }
      e.printStackTrace();
    }
  }

  public void removeProcsDetail(ProcsDetail pd) {
    if (cSService == null) {
      System.out.println("Error in removeProcsDetail(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling removeProcsDetail(" + pd + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.removeProcsDetail(pd);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: removeProcsDetail(" + pd + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: removeProcsDetail(" + pd + ")");
      }
      e.printStackTrace();
    }
  }

  public List findProcsDetail(String whereStr) {
    List returnValue = null;

    if (cSService == null) {
      System.out.println("Error in findProcsDetail(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling findProcsDetail(" + whereStr + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.findProcsDetail(whereStr);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: findProcsDetail(" + whereStr + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: findProcsDetail(" + whereStr + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from findProcsDetail(" + whereStr + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public CostAlgorithm getCostAlgorithm() {
    CostAlgorithm returnValue = null;

    if (cSService == null) {
      System.out.println("Error in getCostAlgorithm(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling getCostAlgorithm()");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.getCostAlgorithm();
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: getCostAlgorithm()");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: getCostAlgorithm()");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from getCostAlgorithm(): " + returnValue + ".");
    }
    return returnValue;
  }

  public void generateCaiLiaoFee() {
    if (cSService == null) {
      System.out.println("Error in generateCaiLiaoFee(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling generateCaiLiaoFee()");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.generateCaiLiaoFee();
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: generateCaiLiaoFee()");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: generateCaiLiaoFee()");
      }
      e.printStackTrace();
    }
  }

  public void generateProcessFee() {
    if (cSService == null) {
      System.out.println("Error in generateProcessFee(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling generateProcessFee()");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.generateProcessFee();
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: generateProcessFee()");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: generateProcessFee()");
      }
      e.printStackTrace();
    }
  }

  public void generateCaiLiaoFeeDiff() {
    if (cSService == null) {
      System.out.println("Error in generateCaiLiaoFeeDiff(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling generateCaiLiaoFeeDiff()");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.generateCaiLiaoFeeDiff();
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: generateCaiLiaoFeeDiff()");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: generateCaiLiaoFeeDiff()");
      }
      e.printStackTrace();
    }
  }

  public void generateProcessFeeDiff() {
    if (cSService == null) {
      System.out.println("Error in generateProcessFeeDiff(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling generateProcessFeeDiff()");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.generateProcessFeeDiff();
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: generateProcessFeeDiff()");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: generateProcessFeeDiff()");
      }
      e.printStackTrace();
    }
  }

  public List getSortedCombinedSimOrder(Product p) {
    List returnValue = null;

    if (cSService == null) {
      System.out.println("Error in getSortedCombinedSimOrder(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling getSortedCombinedSimOrder(" + p + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.getSortedCombinedSimOrder(p);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: getSortedCombinedSimOrder(" + p + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: getSortedCombinedSimOrder(" + p + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from getSortedCombinedSimOrder(" + p + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public CostEstimateDetail getCostEstimateDetail(OrderSumMain osm, List ossList) {
    CostEstimateDetail returnValue = null;

    if (cSService == null) {
      System.out.println("Error in getCostEstimateDetail(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling getCostEstimateDetail(" + osm + ", " + ossList + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.getCostEstimateDetail(osm, ossList);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: getCostEstimateDetail(" + osm + ", " + ossList + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: getCostEstimateDetail(" + osm + ", " + ossList + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from getCostEstimateDetail(" + osm + ", " + ossList + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public CostEstimateDetail getCostEstimateDetail(OrderSumMain osm, List ossList, ComponentFilter filter) {
    CostEstimateDetail returnValue = null;

    if (cSService == null) {
      System.out.println("Error in getCostEstimateDetail(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling getCostEstimateDetail(" + osm + ", " + ossList + ", " + filter + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.getCostEstimateDetail(osm, ossList, filter);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: getCostEstimateDetail(" + osm + ", " + ossList + ", " + filter + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: getCostEstimateDetail(" + osm + ", " + ossList + ", " + filter + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from getCostEstimateDetail(" + osm + ", " + ossList + ", " + filter + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public List CostEstimateCopy(OrderSumMain osmTo, List ossListTo, OrderSumMain osmFrom, List ossListFrom) {
    List returnValue = null;

    if (cSService == null) {
      System.out.println("Error in CostEstimateCopy(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling CostEstimateCopy(" + osmTo + ", " + ossListTo + ", " + osmFrom + ", " + ossListFrom + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.CostEstimateCopy(osmTo, ossListTo, osmFrom, ossListFrom);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: CostEstimateCopy(" + osmTo + ", " + ossListTo + ", " + osmFrom + ", " + ossListFrom + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: CostEstimateCopy(" + osmTo + ", " + ossListTo + ", " + osmFrom + ", " + ossListFrom + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from CostEstimateCopy(" + osmTo + ", " + ossListTo + ", " + osmFrom + ", " + ossListFrom + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public List CostEstimateAdjust(OrderSumMain osm, List ossList, Adjust adj, List osmList, HashMap ossMap) {
    List returnValue = null;

    if (cSService == null) {
      System.out.println("Error in CostEstimateAdjust(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling CostEstimateAdjust(" + osm + ", " + ossList + ", " + adj + ", " + osmList + ", " + ossMap + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.CostEstimateAdjust(osm, ossList, adj, osmList, ossMap);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: CostEstimateAdjust(" + osm + ", " + ossList + ", " + adj + ", " + osmList + ", " + ossMap + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: CostEstimateAdjust(" + osm + ", " + ossList + ", " + adj + ", " + osmList + ", " + ossMap + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from CostEstimateAdjust(" + osm + ", " + ossList + ", " + adj + ", " + osmList + ", " + ossMap + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public List CostEstimateAdjust(OrderSumMain osm, List ossList, String type) {
    List returnValue = null;

    if (cSService == null) {
      System.out.println("Error in CostEstimateAdjust(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling CostEstimateAdjust(" + osm + ", " + ossList + ", " + type + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.CostEstimateAdjust(osm, ossList, type);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: CostEstimateAdjust(" + osm + ", " + ossList + ", " + type + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: CostEstimateAdjust(" + osm + ", " + ossList + ", " + type + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from CostEstimateAdjust(" + osm + ", " + ossList + ", " + type + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public List CostEstimateAdjust(OrderSumMain osm, List ossList, Adjust adj, List osmList) {
    List returnValue = null;

    if (cSService == null) {
      System.out.println("Error in CostEstimateAdjust(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling CostEstimateAdjust(" + osm + ", " + ossList + ", " + adj + ", " + osmList + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.CostEstimateAdjust(osm, ossList, adj, osmList);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: CostEstimateAdjust(" + osm + ", " + ossList + ", " + adj + ", " + osmList + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: CostEstimateAdjust(" + osm + ", " + ossList + ", " + adj + ", " + osmList + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from CostEstimateAdjust(" + osm + ", " + ossList + ", " + adj + ", " + osmList + "): " + returnValue + ".");
    }
    return returnValue;
  }

  public void runGPA(OrderSumMain osm) {
    if (cSService == null) {
      System.out.println("Error in runGPA(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling runGPA(" + osm + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.runGPA(osm);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: runGPA(" + osm + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: runGPA(" + osm + ")");
      }
      e.printStackTrace();
    }
  }

  public void runBP(int type) {
    if (cSService == null) {
      System.out.println("Error in runBP(): " + ERROR_NULL_REMOTE);
      return ;
    }

    long startTime = 0;
    if (logging) {
      log("Calling runBP(" + type + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      cSService.runBP(type);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: runBP(" + type + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: runBP(" + type + ")");
      }
      e.printStackTrace();
    }
  }

  public int[] predicatorNum(String A, int type) {
    int[] returnValue = null;

    if (cSService == null) {
      System.out.println("Error in predicatorNum(): " + ERROR_NULL_REMOTE);
      return returnValue;
    }

    long startTime = 0;
    if (logging) {
      log("Calling predicatorNum(" + A + ", " + type + ")");
      startTime = System.currentTimeMillis();
    }

    try {
      returnValue = cSService.predicatorNum(A, type);
      if (logging) {
	long endTime = System.currentTimeMillis();
	log("Succeeded: predicatorNum(" + A + ", " + type + ")");
	log("Execution time: " + (endTime - startTime) + " ms.");
      }
    }
    catch(Exception e) {
      if (logging) {
	log("Failed: predicatorNum(" + A + ", " + type + ")");
      }
      e.printStackTrace();
    }

    if (logging) {
      log("Return value from predicatorNum(" + A + ", " + type + "): " + returnValue + ".");
    }
    return returnValue;
  }

  //----------------------------------------------------------------------------
  // Utility Methods
  //----------------------------------------------------------------------------

  private void log(String message) {
    if (message == null) {
      System.out.println("-- null");
      return ;
    }
    if (message.length() > MAX_OUTPUT_LINE_LENGTH) {
      System.out.println("-- " + message.substring(0, MAX_OUTPUT_LINE_LENGTH) + " ...");
    }
    else {
      System.out.println("-- " + message);
    }
  }
  //Main method

  public static void main(String[] args) {
    CSTestBpPredicate client = new CSTestBpPredicate();
    // Use the client object to call one of the Home interface wrappers
    // above, to create a Remote interface reference to the bean.
    // If the return value is of the Remote interface type, you can use it
    // to access the remote interface methods.  You can also just use the
    // client object to call the Remote interface wrappers.
  }
}